<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>SPI_returntuple</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 9.1.2 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Memory Management"
HREF="spi-memory.html"><LINK
REL="PREVIOUS"
TITLE="SPI_copytuple"
HREF="spi-spi-copytuple.html"><LINK
REL="NEXT"
TITLE="SPI_modifytuple"
HREF="spi-spi-modifytuple.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2011-12-01T22:07:59"></HEAD
><BODY
CLASS="REFENTRY"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
><A
HREF="index.html"
>PostgreSQL 9.1.2 Documentation</A
></TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
TITLE="SPI_copytuple"
HREF="spi-spi-copytuple.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="spi-memory.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="20%"
ALIGN="right"
VALIGN="top"
><A
TITLE="SPI_modifytuple"
HREF="spi-spi-modifytuple.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SPI-SPI-RETURNTUPLE"
></A
>SPI_returntuple</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN59150"
></A
><H2
>Name</H2
>SPI_returntuple&nbsp;--&nbsp;prepare to return a tuple as a Datum</DIV
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN59155"
></A
><H2
>Synopsis</H2
><PRE
CLASS="SYNOPSIS"
>HeapTupleHeader SPI_returntuple(HeapTuple <TT
CLASS="PARAMETER"
>row</TT
>, TupleDesc <TT
CLASS="PARAMETER"
>rowdesc</TT
>)</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN59159"
></A
><H2
>Description</H2
><P
>   <CODE
CLASS="FUNCTION"
>SPI_returntuple</CODE
> makes a copy of a row in
   the upper executor context, returning it in the form of a row type <TT
CLASS="TYPE"
>Datum</TT
>.
   The returned pointer need only be converted to <TT
CLASS="TYPE"
>Datum</TT
> via <CODE
CLASS="FUNCTION"
>PointerGetDatum</CODE
>
   before returning.
  </P
><P
>   Note that this should be used for functions that are declared to return
   composite types.  It is not used for triggers; use
   <CODE
CLASS="FUNCTION"
>SPI_copytuple</CODE
> for returning a modified row in a trigger.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN59168"
></A
><H2
>Arguments</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="LITERAL"
>HeapTuple <TT
CLASS="PARAMETER"
>row</TT
></TT
></DT
><DD
><P
>      row to be copied
     </P
></DD
><DT
><TT
CLASS="LITERAL"
>TupleDesc <TT
CLASS="PARAMETER"
>rowdesc</TT
></TT
></DT
><DD
><P
>      descriptor for row (pass the same descriptor each time for most
      effective caching)
     </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN59183"
></A
><H2
>Return Value</H2
><P
>   <TT
CLASS="TYPE"
>HeapTupleHeader</TT
> pointing to copied row;
   <TT
CLASS="SYMBOL"
>NULL</TT
> only if
   <TT
CLASS="PARAMETER"
>row</TT
> or <TT
CLASS="PARAMETER"
>rowdesc</TT
> is
   <TT
CLASS="SYMBOL"
>NULL</TT
>
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="spi-spi-copytuple.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="spi-spi-modifytuple.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SPI_copytuple</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="spi-memory.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SPI_modifytuple</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>